package it.koutifaris.travianmap.transformation;

import android.test.AndroidTestCase;

public class Point2SquareTransformationTest extends AndroidTestCase {

	Point2SquareTransformation transformation;

	public void setUp() throws Exception {
		transformation = new Point2SquareTransformation(10);
	}

	public void testTransformX() throws Exception {
		int transformed = transformation.transform(22.5);
		assertEquals(2, transformed);
	}

	public void testNegativeCoords() throws Exception {
		int transformed = transformation.transform(-1);
		assertEquals(-1, transformed);
	}

	public void testOrigin() throws Exception {
		int transformed = transformation.transform(0);
		assertEquals(0, transformed);
	}

	public void testPositiveEdge() throws Exception {
		int transformed = transformation.transform(10);
		assertEquals(1, transformed);
	}

	public void testNegativeEdge() throws Exception {
		int transformed = transformation.transform(-20);
		assertEquals(-2, transformed);
	}

}
